module ToolLogosHelper
  def tool_logo_image_tag(tool,args)
    args = {
      :alt => "#{tool.tool_type.name}-#{tool.name}-#{sanitize_all tool.synopsis}",
      :title => "#{tool.tool_type.name}-#{tool.name}-#{sanitize_all tool.synopsis}"
    }.merge(args)
    if tool.logo
      image_tag tool_logo_path(tool.logo,:jpg), args
    else
      image_tag "tools/toast.png",args
    end
  end
  
  def link_to_new_or_edit_tool_logo(tool,html_options = {})
    link_to '✎设置图标', new_tool_logo_url(:tool_id => tool.id), { :title => "设置#{tool.name}的个性图标" }.merge(html_options)
  end
end
